
// 2. 创建 reducer
const countReducer = (state = { count: 100 }, actions) => {

    const { type, payload } = actions
    switch (type) {
        case 'add':

            return { ...state, count: state.count + 1 }

        case 'addNum':

            return { ...state, count: state.count + payload }
        default:
            return state
    }

}


export default countReducer